//
//  DSSHPointMaterialVC.m
//  DSSH
//
//  Created by lcy on 16/4/6.
//  Copyright © 2016年 lcy. All rights reserved.
//

#import "DSSHPointMaterialVC.h"
#import "DSSHPointDetailVC.h"
#import "UIView+Round.h"
@interface DSSHPointMaterialVC ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView* pointTableView;
@end

@implementation DSSHPointMaterialVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupViewAndData];
    // Do any additional setup after loading the view.
}
-(void)setupViewAndData
{
    self.title = @"点位资料";
    self.view.backgroundColor = [UIColor whiteColor];
    self.pointTableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    self.pointTableView.delegate = self;
    self.pointTableView.dataSource = self;
    self.pointTableView.tableFooterView = [[UIView alloc]init];
    [self.view addSubview:self.pointTableView];
    
    UIBarButtonItem * backBarBtn = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"fanhui"] style:UIBarButtonItemStylePlain target:self action:@selector(backBarBtnClick)];
    self.navigationItem.leftBarButtonItem = backBarBtn;
}
-(void)backBarBtnClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString* cellID = @"cellID";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        UIView * bgView = [UIView new];
        bgView.layer.borderWidth = 1;
        bgView.layer.borderColor = [[UIColor groupTableViewBackgroundColor]CGColor];
        [cell.contentView addSubview:bgView];
        [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(cell.contentView).with.offset(-5*WIDTH_SCALE);
            make.left.equalTo(cell.contentView).with.offset(5*WIDTH_SCALE);
            make.top.equalTo(cell.contentView).with.offset(5*HIGHT_SCALE);
            make.bottom.equalTo(cell.contentView).with.offset(-5*HIGHT_SCALE);
        }];
        [bgView getRoundView:5];
        
    }
    cell.textLabel.text = @"A座1栋1单元1梯K1";
    cell.textLabel.font = FONT(13);
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    DSSHPointDetailVC * detailVC = [[DSSHPointDetailVC alloc]init];
    [self.navigationController pushViewController:detailVC animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
